function MM_preloadImages()
    {
        var g=document;
        if(!g.images){
            return
        }
        var c=g.images;
        if(!g.MM_p){
            g.MM_p=new Array()
        }
        var f,e=g.MM_p.length,b=MM_preloadImages.arguments;
        for(f=0;f<c.length;f++){
            if(c[f].src.search(/_off/)!=-1&&c[f].src.search(/selected_off/)==-1)
            {
                g.MM_p[e]=new Image;
                g.MM_p[e++].src=c[f].src.replace(/_off/,"_on")
            }
        }
        for(f=0;f<b.length;f++)
        {
            g.MM_p[e]=new Image;g.MM_p[e++].src=b[f]
        }
    }
    function checkEnter(b,c){
        var d=(document.layers)?true:false;
        var a=0;
        if(d){
            a=b.which
        }else{
            a=b.keyCode
        }
        if(a==13){
            document.forms[c].submit()
        }
    }
    
    function submitForm(c,a)
    {
        var b=document.forms[c];
        var d=b.elements[a];
        d.name+="_x";d.value="33";
        b.submit();
        return
    }
    
    function setsmiley(a){
        document.post.message.value=document.post.message.value+a;
        document.post.message.focus()
    }
    
    function highlight(a,b){
        document.images[a].src=b;
        return
    }
    
    function openSmallWindow(b,a){
        window.open(b,a,"width=544,height=600,scrollbars=yes,resizable=yes,dependent=yes");
        return false
    }
    
    function openClose(a){
        if(this.document.getElementById(a).style.display=="none"){
            this.document.getElementById(a).style.display=""
        }else{
            this.document.getElementById(a).style.display="none"}
        }
        
    function checkDotsOnSubmit(c,b){
        var d=(document.layers)?true:false;
        var a=0;
        if(d){
            a=c.which
        }else{
            a=c.keyCode
        }
        if(a==13){
            checkDots(b)
        }
    }
    
    function checkDots(a){
        var b=removeDots(a.value);
        if(isNaN(b)==true){
            return
        }
        a.value=insertDots(b)
    }
    
    function checkLongNumber(a){
        var b = removeDots(a.value);
         if(isNaN(b)==true){
            return
        }else{
            if (b < 500000000){
                a.value=insertDots(b);
            }else{
                a.value=insertDots(500000000);
            }
        }
    }
    
    function removeDots(b){
        if(b=="")
        {
            return""
        }
        var a=String(b);
        return a.replace(/\./g,"")
    }
    
    function insertDots(d){
        var c=String(d);
        var b=c.length%3;
        if(isNaN(c.charAt(0)))
        {
            return c.charAt(0)+insertDots(c.substring(1,c.length))
        }
        var a=c.substring(0,b);
        for(;b<c.length;b=b+3)
        {
            if(a!="")
            {
                a=a+"."
            }
            a=a+c.substr(b,3)
        }
        return a
    }
    
    function insertElementById(b,a)
    {
        if(a&&b)
        {
            if(document.layers){
                sprite=document.layers[""+b+""].document;
                sprite.open();
                sprite.write(a);
                sprite.close()
            }else{
                if(document.all)
                {
                    document.all[""+b+""].innerHTML=a
                }else{
                    if(document.getElementById)
                    {
                        rng=document.createRange();
                        el=document.getElementById(""+b+"");
                        rng.setStartBefore(el);
                        htmlFrag=rng.createContextualFragment(a);
                        while(el.hasChildNodes())
                        {
                            el.removeChild(el.lastChild)
                        }
                        el.appendChild(htmlFrag)
                    }
                }
            }
        }
    }
    function CheckAll(b){
        for(var a=0;a<document.forms[b].elements.length;a++)
        {
            var c=document.forms[b].elements[a];
            if(c.name!="Checkall"&&c.type=="checkbox"){
                c.checked=document.forms[b].elements.Checkall.checked
            }
        }
    }
    function checkAllbudget(d)
    {
        var b=document.forms[d].elements.Checkall.checked;
        var c=parseFloat(document.getElementById("sumoffers").value);
        var e=parseFloat(document.getElementById("wholesum").value);
        var a=parseFloat(document.getElementById("budget").value);
        var f=parseFloat(c)+e;
        if(b)
        {
            setbudget(a,f)
        }else{
            setbudget(a,c)
        }
        return
    }
    
    function checkbudget(b){
        var a=document.getElementById("budget");
        if(a==null){
            return
            }
        var k=document.getElementById("sumoffers");
        if(k==null){
            k=0
        }else{
            k=parseFloat(k.value)
        }var d=document.forms[b].elements;
        var l=0;
        var f=d.length;
        var h=false;
        for(var e=0;e<f;e++){
            if(d[e].value==""||d[e].type!="text"||d[e].name.substring(0,5)!="price")
            {
                continue
            }
            var j=removeDots(d[e].value);
            var c=parseFloat(j);
            if(!isNaN(c)&&j>=0){
                l+=c
            }else{
                h=true
            }
        }
        if(!h)
        {
            var g=parseFloat(a.value);
            l=(l*(-1))+k;setbudget(g,l)
        }else{
            insertElementById("newbudget","Ung�ltiger Wert")
        }
        return
    }
    
    function setbudget(a,d){if((a+d)<0){var b='<font color="red">'+insertDots((a+d))+"</font>"}else{var b=insertDots(a+d)}insertElementById("diffbudget",""+insertDots(d)+"");insertElementById("newbudget",""+b+"");var c=document.getElementById("hidden_dif");if(c!=null){document.getElementById("hidden_dif").value=d}return}function get_values(e,c,b){var a=parseFloat(removeDots(document.getElementById("budget").value));var d=parseFloat(removeDots(document.getElementById("hidden_dif").value));var f=document.forms[b].elements["choice["+e+"]"].checked;c=parseFloat(c);if(f){d=(d+c)}else{d=(d-c)}setbudget(a,d);return}var myvalues=new Array();function loadOptions(g){UserAgent=navigator.userAgent;if(UserAgent.indexOf("Opera")!=(-1)){return}var j=0;var a=document.forms[g].length;var e=0;for(var d=0;d<a;d++){var f=document.forms[g].elements[d];if(f.type=="select-one"){myvalues[j++]=new Array();var c=0;for(var b=0;b<f.length;b++){myvalues[e][c]=new Array();myvalues[e][c][0]=f.options[b].value;myvalues[e][c][1]=f.options[b].text;c++}e++}}changeOptions(g,"false");return}function refreshAllOptions(g,e){var c=0;var f;var a=document.forms[g].length;for(var d=0;d<a;d++){var h=document.forms[g].elements[d];if(h.type=="select-one"){f=0;for(var b=0;b<myvalues[c].length;b++){h.options[f]=null;if(myvalues[c][b][0]==e[d]){h.options[f]=new Option(myvalues[c][b][1],myvalues[c][b][0],false,true);f++}else{if(inArray(myvalues[c][b][0],e)==false){h.options[f]=new Option(myvalues[c][b][1],myvalues[c][b][0]);f++}}}c++}}}function inArray(b,c){if(c.length>0){for(var a=0;a<c.length;a++){if(c[a]==b){return true}}}return false}function getSelectedOptions(d){var e=new Array();var a=document.forms[d].length;for(var b=0;b<a;b++){var c=document.forms[d].elements[b];if(c.type=="select-one"&&c.options[c.selectedIndex].value!=""){e[b]=c.options[c.selectedIndex].value}}return e}function delOptions(d,g){var f=document.forms[d];var a=f.length;for(var c=0;c<a;c++){var e=f.elements[c];if(e.type=="select-one"){for(var b=0;b<e.length;b++){if(e.options[b].value==g&&e.options[b].selected==false){e.options[b]=null}}}}return true}function changeOptions(c,a){UserAgent=navigator.userAgent;if(UserAgent.indexOf("Opera")!=(-1)){return}var b=new Array();b=getSelectedOptions(c);if(a=="true"){refreshAllOptions(c,b)}for(var d=0;d<b.length;d++){delOptions(c,b[d])}}function getCheckedBoxes(d,b){if(typeof(b)=="undefined"){b=true}var h;var f;var g=0;var a=document.forms[d].length;for(var c=0;c<a;c++){var e=document.forms[d].elements[c];if(e.type=="checkbox"&&e.checked==b){h=parseFloat(e.value);f=document.getElementById(""+h+"");g+=parseFloat(f.value)}}return g}function checkboxLoader(b){var f=0;var h=0;var c=0;var i=0;f=getCheckedBoxes(b);h=getCheckedBoxes(b,false);c=parseFloat(document.getElementById("current_budget").value);var g=parseFloat(document.getElementById("VALUE_LIMIT").value);var a=parseFloat(document.getElementById("REWARD_FACTOR").value);var e=parseFloat(document.getElementById("PENALTY_FACTOR").value);var d=parseFloat(document.getElementById("REWARD_LIMIT").value);if(c>d){i=((d+f+h)*a)}else{i=((c+f+h)*a)}if(f>g){i=insertDots(Math.floor(i-(e*(f-g))));f='<font color="#ff9900">'+insertDots(f)+"</font>"}else{i=insertDots(Math.floor(i+(g-f)));f=insertDots(f)}insertElementById("newbudget",""+f+"<br /><br />"+i+"");return true}function addInput(b,d,f){var e="";var a="";if(typeof(f)=="undefined"){f=1}myvalues[myvalues.length]=true;for(var c=f;c<=myvalues.length;c++){if(document.getElementById(""+d+"["+c+"]")!=null){a=document.getElementById(""+d+"["+c+"]").value}else{a=""}e+="Url("+(c+1)+')<br /><input type="'+b+'" name="'+d+"["+c+']" id="'+d+"["+c+']"  value="'+a+'" size="60" maxsize="400"><br />'}insertElementById("addTextBoxes",""+e+"")}function submitCheck(){var a=confirm("Do you want to submit the input?");if(a==true){return true}return false}function sortMultiArray(d,c){if(d[0]<c[0]){return 1}else{if(d[0]>c[0]){return -1}else{return 0}}}function sortMultiArray2(d,c){if(d[2]<c[2]){return 1}else{if(d[2]>c[2]){return -1}else{return 0}}}function getcurrentpos(j){var l=new Array();var i=new Array();var b;var g=new Array();var m;var c;var h;var a;var q=0;var d;if(isNaN(j)==true){j=7}for(var r=0;r<document.getElementsByTagName("input").length;r++){g=document.getElementsByTagName("input")[r].name.match(/(now)\[(\d+)\]/);if(document.getElementsByTagName("input")[r].type=="hidden"&&g!=null){b=parseFloat(g[2]);m=parseFloat(document.getElementsByName("add["+b+"]")[0].value);c=parseFloat(document.getElementsByTagName("input")[r].value);d=parseFloat(document.getElementsByName("sec_value["+b+"]")[0].value);if(isNaN(c)==false){h=c}else{h=0}if(isNaN(m)==false){a=(h-m)}else{a=h}if(i.length>0){q=(i.length)}d=d.toString();while(d.length<j){d="0"+d}i[q]=new Array(a,b,parseFloat(a+""+d));l[q]=new Array(h,b,parseFloat(h+""+d))}}i.sort(sortMultiArray2);var f=new Array("hold","up","down");var p=document.getElementsByTagName("input")["IMG_DIR"].value;var o;for(var e=0;e<l.length;e++){o=(inArrayMultiKey(l[e][1],i,1)-e);var n=o;if(o>0){o=1}if(o<0){o=2}if(o==0){o=0}insertElementById("uid"+l[e][1],'<img src="'+p+f[o]+'.gif" title="'+n+'" alt="'+n+'">')}return true}function inArrayMultiKey(b,d,c){if(d.length>0){for(var a=0;a<d.length;a++){if(d[a][c]==b){return a}}}return false}function check_cookie_value(a){var e=document.cookie.split("; ");var d;for(var b=0;b<e.length;++b){d=e[b].split("=");if(d[0]==a){return d[1]}}return false}function display_by_id(d,a,c){if(isNaN(d)){var b=document.getElementById(""+d+"");if(c=="true"){if(a=="block"){return b.style.display="none"}else{return b.style.display="block"}}else{return b.style.display=a}return b.style.display}return false}function set_cookie_var(d,c,a){if(isNaN(a)){a=new Date();var b=a.getTime()+(5*24*60*60*1000);a.setTime(b)}document.cookie=d+"="+c+"; expires="+a.toGMTString();return true}function display_table(e,a,d,b){var c=check_cookie_value(e);if(typeof(a)=="undefined"){a="none"}if(isNaN(c)){a=display_by_id(e,c,d)}else{a=display_by_id(e,a)}if(b!=false)
        {
        set_cookie_var(e,a)
    }
    return true};
        
        
    function transferibles()
    {
        document.forms['transferibles'].Atransferir.value='Si'; 
        document.forms['transferibles'].submit();
    }
    
    function realizarpuja()
    {
        document.forms['pujarxjugador'].Pujar.value='Si'; 
        document.forms['pujarxjugador'].submit();
    }
    
    function aceptarofertasrecibidas()
    {
       document.forms['ofertasrecibidas'].AceptarOfertas.value='Si'; 
       document.forms['ofertasrecibidas'].submit();
    }
    
    function cancelarofertas()
    {
       document.forms['ofertasrealizadas'].CancelarOfertas.value='Si'; 
       document.forms['ofertasrealizadas'].submit();
    }
    
    function numeros(caja)
    {
        var num = caja.value;
        if(isNaN(num)){
            caja.value = "";
        }
    }
    
        function quitartransferibles()
    {
        document.forms['quitarmercado'].quitarjugadores.value='Si'; 
        document.forms['quitarmercado'].submit();
    }
    
    function actualizaReloj(){  
    
       	/* CAPTURAMOS LA HORA, LOS MINUTOS Y LOS SEGUNDOS */ 
        marcacion = new Date()  
        
       	/* CAPTURAMOS LA HORA */ 
        Hora = marcacion.getHours()  
        
       	/* CAPTURAMOS LOS MINUTOS */ 
        Minutos = marcacion.getMinutes()  
        
       	/* CAPTURAMOS LOS SEGUNDOS */ 
        Segundos = marcacion.getSeconds()  
        
       	/* SI LA HORA, LOS MINUTOS O LOS SEGUNDOS 
        SIN MENORES O IGUAL A 9, LE AÑADIMOS UN 0 */ 
        
        if (Hora<=9) 
        Hora = "0" + Hora 
        
        if (Minutos<=9) 
        Minutos = "0" + Minutos 
        
        if (Segundos<=9) 
        Segundos = "0" + Segundos 
        	/* TERMINA EL SCRIPT DEL RELOJ */
        
       	/* COMIENZA EL SCRIPT DE LA FECHA */ 
        var Dia = new Array("Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado", "Domingo"); 
        var Mes = new 
        
        Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"); 
        var Hoy = new Date(); 
        var Anio = Hoy.getFullYear(); 
        var Fecha = "" + Dia[Hoy.getDay()] + ", " + Hoy.getDate() + " de " + Mes[Hoy.getMonth()] + " de " + Anio + ". Hora local: "; 
       	/* TERMINA EL SCRIPT DE LA FECHA */ 
       
       	/* CREAMOS 4 VARIABLES PARA DARLE FORMATO A NUESTRO SCRIPT */ 
        var Inicio, Script, Final, Total 
        
       	/* EN INICIO LE INDICAMOS UN COLOR DE FUENTE Y UN TAMAÑO */ 
        Inicio = " " 
        
       	/* EN RELOJ LE INDICAMOS LA HORA, LOS MINUTOS Y LOS SEGUNDOS */ 
        Script = Fecha + Hora + ":" + Minutos + ":" + Segundos 
        
       	/* EN FINAL CERRAMOS EL TAG DE LA FUENTE */ 
        Final = " " 
        
       	/* EN TOTAL FINALIZAMOS EL RELOJ UNIENDO LAS VARIABLES */ 
        Total = Inicio + Script + Final 
        
       	/* CAPTURAMOS UNA CELDA PARA MOSTRAR EL RELOJ */ 
        document.getElementById('Fecha_Reloj').innerHTML = Total 
        
       	/* INDICAMOS QUE NOS REFRESQUE EL RELOJ CADA 1 SEGUNDO */ 
        setTimeout("actualizaReloj()",1000)  
    } 